const fs = require('fs');

const filePath = process.argv[2];
const newBuildNumber = process.argv[3];
const commitHash = process.argv[4];

const fileData = `
export const BUILD_NUMBER = ${newBuildNumber};
export const SHORT_COMMIT_HASH = '${commitHash}';
`;

fs.writeFile(filePath, fileData, 'utf8', (err) => {
    if (err) {
        console.error(`Error writing file: ${err}`);
        process.exit(1);
    }
    console.log(`BUILD_NUMBER updated to ${newBuildNumber} in ${filePath}`);
    console.log(`SHORT_COMMIT_HASH updated to ${commitHash} in ${filePath}`);
});